/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package edi.dao;

import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
  

import java.util.List;
import edi.entities.UserEntity;

@Repository
@Transactional
public class UsrDaoImp extends HibernateCrudDao<UserEntity> implements UserDao {
    
    public UsrDaoImp() {
	super(UserEntity.class);
    }

    @Override
    public UserEntity findByLogin(String login) {
	return (UserEntity) session().createQuery("from UserEntity where usrLogin = :login").setString("login", login).uniqueResult();
        
        
    }   
        
    @Override
    public List<UserEntity> findByLastName(String name) {
	return session().createQuery("from UserEntity where usrFirstName = :name").setString("name", name).list();
    } 
        
    @Override
    public List<UserEntity> findByStatus(String stat) {
	return session().createQuery("from UserEntity where usrStatus = :stat").setString("stat", stat).list();
    } 
        
            
}   



